package cn.itsource.document;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Document(indexName = "hrm" , type = "employee")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EmployeeDoc {

    //对应文档的id  PUT  /index/type/id
    @Id
    private Long id;

    @Field(type = FieldType.Keyword)    //指定为 不分词
    private String userName;

    @Field(type = FieldType.Integer)
    private int age;

    @Field(type = FieldType.Integer)
    private int sex;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String intro;

}